From 072f03be952e480445da31d0f659e9e55d0dcf50 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Tue, 1 Mar 2005 22:48:54 +0000 Subject: [PATCH] bitkeeper revision 1.1236.1.44 (4224f156AyEV3oV5JinuYtfS9e_ITA) Rationalise memory-barrier definitions in user-space tools. Signed-off-by: Jerone Young Signed-off-by: Keir Fraser --- tools/blktap/blktaplib.h | 16 ---------------- tools/libxc/xc.h | 28 ++++++++++++++++++++++------ tools/python/xen/lowlevel/xu/xu.c | 8 -------- tools/xcs/xcs.h | 7 ------- 4 files changed, 22 insertions(+), 37 deletions(-) diff --git a/tools/blktap/blktaplib.h b/tools/blktap/blktaplib.h index 7b38f565fc..2cdf48165c 100644 --- a/tools/blktap/blktaplib.h +++ b/tools/blktap/blktaplib.h @@ -10,22 +10,6 @@ #include -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#if defined(__i386__) -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" ) -#define wmb() __asm__ __volatile__ ( "" : : : "memory" ) -#else -#error "Define barriers" -#endif - #include #include #include diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h index 81d7b2ed3f..3b587e923f 100644 --- a/tools/libxc/xc.h +++ b/tools/libxc/xc.h @@ -25,9 +25,25 @@ typedef int64_t s64; #include #include -/*\ + +/* + * DEFINITIONS FOR CPU BARRIERS + */ + +#if defined(__i386__) +#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") +#define wmb() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__x86_64__) +#define mb() asm volatile("mfence":::"memory") +#define rmb() asm volatile("lfence":::"memory") +#define wmb() asm volatile( "" :::"memory") +#else +#error "Define barriers" +#endif + +/* * INITIALIZATION FUNCTIONS -\*/ + */ /** * This function opens a handle to the hypervisor interface. This function can @@ -55,9 +71,9 @@ int xc_interface_open(void); */ int xc_interface_close(int xc_handle); -/*\ +/* * DOMAIN MANAGEMENT FUNCTIONS -\*/ + */ typedef struct { u32 domid; @@ -257,9 +273,9 @@ int xc_rrobin_global_get(int xc_handle, u64 *slice); typedef evtchn_status_t xc_evtchn_status_t; -/*\ +/* * EVENT CHANNEL FUNCTIONS -\*/ + */ /** * This function allocates an unbound port. Ports are named endpoints used for diff --git a/tools/python/xen/lowlevel/xu/xu.c b/tools/python/xen/lowlevel/xu/xu.c index 16768429b2..5444bcd171 100644 --- a/tools/python/xen/lowlevel/xu/xu.c +++ b/tools/python/xen/lowlevel/xu/xu.c @@ -49,14 +49,6 @@ /* Size of a machine page frame. */ #define PAGE_SIZE 4096 -#if defined(__i386__) -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" ) -#define wmb() __asm__ __volatile__ ( "" : : : "memory" ) -#else -#error "Define barriers" -#endif - - /* Set the close-on-exec flag on a file descriptor. Doesn't currently bother * to check for errors. */ /* diff --git a/tools/xcs/xcs.h b/tools/xcs/xcs.h index 545fc3d05f..5a26724ce1 100644 --- a/tools/xcs/xcs.h +++ b/tools/xcs/xcs.h @@ -39,13 +39,6 @@ /* Size of a machine page frame. */ #define PAGE_SIZE 4096 -#if defined(__i386__) -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" ) -#define wmb() __asm__ __volatile__ ( "" : : : "memory" ) -#else -#error "Define barriers" -#endif - #ifndef timersub /* XOPEN and __BSD don't cooperate well... */ #define timersub(a, b, result) \ do { \ -- 2.30.2